Method to convert bitmaps to monochrome data

ABSTRACT

A processor unit converts source image data to a rasterized monochrome bit map and includes a random access memory, a storage memory containing a gray scale conversion table, dithering matrices, procedures for determining destination image dithering tiling locations, scaling conversion procedures and sub routines for establishing a gray scale value array indexed to a bit mask array. The processor unit performs a method of converting source image data to a rasterized compressed monochrome bit map which involves a conversion cycle for converting source pixels to gray scale value and output position bits within the two arrays. Testing is performed to determine all of the source pixels converted to the same gray scale value, and if so, a read ahead cycle commences, reading ahead in the source pixel row for as long as the unconverted source image data bytes are the same as for those converted in the conversion cycle. The converted output position bits of the converted source pixels are dithered. Optionally, an attempt is made to generate a compressed data repeated run entry with a default to a literal run entry based upon dithering of only the converted source pixel output position bits and a count of repeating source pixels.

This application is a continuation-in-part of Ser. No. 07/960,761, filed Oct. 13, 1992, U.S. Pat. No. 5,457,772.

APPENDIX

A appendix of computer program code accompanies this Application, and is a part hereof.

BACKGROUND OF THE INVENTION

1. Technical Field

This invention relates to a process for converting source bit map data to monochrome data, and more particularly to convert bit map data to resolution scaled monochrome data without explicit processing of all repeating source data.

2. Background Art

Prior art processes for converting source images, usually color source data, to monochrome rasterized bit maps typically require examination of each pixel of the source bit map and conversion of the color information for each pixel to a gray scale value. After conversion, the correct dithering matrix is retrieved and scaled output pixels are generated. This is a slow, cumbersome process involving a large number of computations. This is especially so when converting visual color image data to high resolution raster bit maps, such as those utilized by laser printers having print engines capable of 300 or even 600 dots per inch. The rasterized bit map for monochrome image at 300 dots per inch resolution requires approximately a megabyte of raster memory for each letter-size page. At 600 dots per inch, 3.8 megabytes of memory are required. If the conversion process converts each individual source pixel, one at a time, and dithers each scaled group of output pixels resulting from each source pixel, processing 3.8 megabytes of rasterized bits of output image results in 30 million conversion computations and 30 million dithering operations which can take a considerable amount of time.

Laser printers typically include an on board or internal memory capable of receiving rasterized data bit map information from a host processor. This bit map is used to construct page intermediate strips of rasterized data. The page intermediate strips of rasterized data are delivered to the laser print engine which operates at a constant speed. If new rasterized data is not available at a rate that keeps up with the engine's operation, a print "overrun" occurs and the page is not printable. To prevent this from occurring, page intermediate formatting must occur at a high enough rate to keep up with the print engine. This can only be accomplished if the host processor is sending data at a high enough rate of speed, or the printer contains sufficient internal memory to hold a sufficient portion of destination image bit map which has been delivered to it at perhaps a slower rate of speed from the host processor. If the conversion, dithering and rasterization execution time, either in the random access memory (RAM) of the printer, or the host processor, is greater than the time within which page intermediate strips must be constructed for delivery to the print engine, print overruns will occur.

Execution time for prior art conversion procedures is oftentimes too slow to keep up with the construction times needed for the construction of page intermediate strips for delivery to the print engine. As a result, a number of data conversion and compression techniques are employed, usually executed in the host processor, prior to transmission of data to the printer memory to increase the rate of data transfer from the host processor to the on board memory, such that page intermediate construction can commence during the transfer while at the same time minimizing the amount of required internal printer RAM for raster memory.

Thus, in the prior art, conversion of the source color image to a rasterized bit map monochrome image has usually been completed and stored in the host processor RAM, and a compression procedure is conducted prior to transmission of the bit map image data to the on-board RAM of the printer.

What is needed is a process which speeds up the conversion process by eliminating the need to convert each individual pixel's color data information to a gray scale value where there are strings of repeating color data. Also, to increase the speed of execution time, what is needed is a process by which the requirement to dither the scaled output pixels derived from the conversion of repeating source pixels is eliminated, particularly when upscaling to a higher resolution image than the original source image. The achievement of either or both of these goals facilitates use of the conversion process, and the construction of a device independent, monochrome bit map in either the host processor, printer processor or a peripheral device processor.

Accordingly, it is an object of this invention to provide a process by which strings of repeating source pixels need not all be converted to gray scale values, and wherein all of the scaled output pixels resulting from the scaling of the source pixels need not all be individually dithered to produce a complete rasterized bit map.

SUMMARY OF THE INVENTION

A processor unit is used to convert source image data to a rasterized, monochrome bit map and includes a random access memory (RAM), a processor and a control memory that holds a plurality of procedures necessary to convert the source image data to the rasterized, monochrome bit map, including a storage memory containing a gray scale conversion table, dithering matrices, procedures for determining destination image dither tiling locations, scaling conversion calculations, and sub routines for establishing two arrays, a gray scale value array, and a bit mask array, each containing a number of elements equal to the dither pattern width of the output image dither tiles.

The processor unit is used in conjunction with a three part conversion process, including an initial conversion cycle, a read-ahead cycle, and an optional compressed data dithering cycle.

The process begins with the initial conversion cycle, wherein data information, usually color data, for source pixels are converted to gray scale values which are entered in elements of the gray scale value array. Appropriately scaled output position bits are then entered into corresponding bit mask elements. Conversion of source pixels and entry of output position bits into the same or additional bit mask array elements continues until a counter determines that there are sufficient output position bits to fill a dither pattern tile width or row within the output image. The first element of the bit mask array is then tested to determine whether it contains all of the output position bits, which if it does, it indicates that repeating data, usually repeating color data, is present.

If the test indicates repeating data in the source image, then the read ahead cycle is initiated, wherein the unconverted data information for additional source pixels is read and directly compared to the unconverted original data for the already converted source pixels and continues until either the end of the source row is reached, or until source data of different value is encountered. Upon reading ahead to the end of the row, or encountering a source pixel of different data value, the read ahead cycle ends and the dithering cycle begins.

The read ahead cycle is skipped if the first bit mask array element test indicates that not all output position bits are located within the first bit mask element, and the process proceeds directly with the dithering cycle.

The dithering cycle begins with selection of the appropriate dithering matrix for the first element of the gray scale value array. The selected dithering matrix is rotated or repositioned so that the first bit in the dithering matrix corresponds in both its X and Y position, to the actual X and Y position within the destination image dithering tile for the first output position bit to be dithered. Then, the entire first element of the bit mask array is ANDed to the rotated dither matrix to generate output bits. Each bit mask element corresponds in size to the output image dithering tile width and, for purposes of data compression is divisible, in the X axis, by eight so as to facilitate direct data compression.

In the event repeating data has been encountered, the dithering process calculates the number of scaled output bits in the repeating string, and either generates the output data or attempts to compress the dithered output signal from the ANDing of the first bit mask element to the dithering matrix to a single byte and, if successful, generates a repeating run compressed data signal for transmission to an output buffer. In the event that a compressed repeating run string cannot be generated, a literal run compressed data signal may be generated and transmitted to the output buffer.

In the event that reading ahead did not occur, essentially the same process is used, ANDing successive bit mask array elements to the appropriate, rotated dithering matrices and ORing the outputs together to form an output signal.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a high level block diagram of a processor unit that is adapted to carry out the invention.

FIGS. 2A through D is a global flow diagram illustrating the overall procedure of the invention hereof without the use of any compression for the output image signal.

FIG. 2E is a substitute drawing for FIG. 2D which in conjunction with FIGS. 2A through C, represents a global flow diagram illustrating the overall procedure of the invention utilizing an output data compression procedure.

FIG. 3 illustrates the conversion process employed in accordance with the procedures of FIG. 2.

FIG. 4 illustrates the conversion process employed in accordance with the procedures of FIG. 2.

DETAILED DESCRIPTION OF THE INVENTION

Hereafter, the invention will be described in the context of converting color video image data to a monochrome, rasterized image data for a laser printer. However, it should be understood that any source data and other devices, such as plotters, facsimile units, etc., can also make use of the procedures embodied within this invention.

Attached as an appendix is the actual computer code used to practice the invention described herein. The teachings of the appended microfiche are hereby incorporated by reference.

In FIG. 1, processor unit 10 includes micro processor 12, input port 18, random access memory (RAM) 14, storage memory 16, output port 20, all connected by bus 22 and contains all of the procedures necessary to assure the conversion of color image data bit maps to scaled monochrome bit maps. Processing unit 10 can be incorporated in a variety of different data processing units, including, but not limited to host processors, printers, or separate stand alone peripheral units.

Image data from an input is received via input port 18 and read into RAM 14. The image data may take one of several forms. It may include sub-images or pixels wherein the descriptors are contiguous with each sub-image and are processed along with each sub-image or wherein the sub-image or pixel descriptors are received separately from (but linked to) the actual sub-image data. In both versions, when processor unit 10 receives image data, it is parsed and commands and data are processed to derive raster graphics data that includes source image color data and location descriptors for each pixel of the source image.

Storage memory 16 contains the sub routines that carry out the conversion procedure which include gray scale conversion table 28, dithering matrices 30, procedures for determining destination dither tiling locations 34, scaling conversion procedures 36, two arrays, gray scale value array 24 and bit mask array 26 and compression procedures 32 if processing unit 10 is to be used in a configuration where it is integral with a host processor, even possibly, if it is a stand alone peripheral unit.

The two arrays, gray scale value array 24 and bit mask array 26, each contain a number of elements equal to the dither pattern width of the output image dither tiles. Each are, in the preferred embodiment, evenly divisible by eight to facilitate data compression.

In the preferred embodiment, the gray scale monochrome data is contained in a single eight bit byte, thus providing an availability of 254 shades of gray between pure white, represented by the binary number for 255, and solid black, represented by the binary number for 0. In all cases, regardless of whether the color data is contained in a single byte format, or where the color data format is four bits per pixel, twenty four bits per pixel or any other number, the source color data must be normalized during conversion to an appropriate monochrome gray shade, as for example the sixteen available colors in four bits per pixel color data format are spread across the spectrum of the 256 available shades of monochrome data.

The bit mask array 26 is intended to hold information indicating the relative positions of the output pixels that will be generated for each associated gray value. Like the gray scale value array, it contains the number of elements equal to the dither pattern matrix width and, in the preferred embodiment is evenly divisible by eight for purposes of facilitating data compression. Each element of the bit mask array contains a bit block of sufficient size to hold the number of output position bits equal to the dither pattern tile width of the output image, so that in the event all of the output pixels are of the same gray scale value, they can be contained within a single bit mask element. The elements of gray scale value array 24 and bit mask array 26 correspond to each other by their element indexes. For purposes of example, and for demonstrating the preferred embodiment, the following parameters will be used: processor unit 10 is located within a laser printer; the source color image the video image of a host processor, with rasterized pixels at a resolution of seventy four per inch; the source color data for each pixel is contained in one eight bit byte which corresponds to 256 available colors including white and black; the dithering pattern matrices for the output image tiles are sixteen pixels by sixteen pixels (X_(DN) and Y_(DN) where DN ranges from DN=1 to DN=16); the device to which the output pixel data will be sent is the print engine of a laser printer having a laser engine with a resolution of 600 dots per inch (DPI); and finally, the source image, as is usually the case, contains a significant amount of repeating data.

Turning to FIG. 2, a flow diagram, illustrates the actions taken in the peripheral unit to convert the pixels of the source color image to a monochrome bit map. In the first step, source image data is received through input port 18 and is converted to a raster graphic bit map, the source color data format is identified, and the scaling format to be used is calculated using scaling conversion procedures. With regard to the scaling format, the source format in this example is seventy four pixels per inch, and the output format or resolution is 600 DPI, which will result in scaling ratio of approximately 8.1 output pixels in both the horizontal, or X direction, and the vertical, Y, direction, for each input pixel, thus requiring the necessity of periodic rounded scaling so as to provide an output of 600 output pixels for each seventy four input pixels. In FIG. 2 the number of X pixels to be generated by scaling is designated as X_(s), and the number of Y rows to be generated by scaling is designated as Y_(s), wherein both cases in the present example S ranges from S=1 to S=8, or 9 depending upon whether periodic rounding is occurring.

Since the number of destination or output pixels to be generated by each source pixel is proportional to the ratio of the number of output pixels in one raster row divided by the number of source pixels in the corresponding source row, it is useful for accurate conversion that extra output pixels be added to the image in identical locations within each row. For that reason all scaling calculations and the addition of extra output pixels begins anew at the beginning of each row, and is measured, for each row, from a fixed reference point. In a like manner, all scaling calculations and the addition of additional output rows begin from a fixed reference point. This feature enables the inputing and processing of the source color image in a piece-wise or segmented, manner.

It should also be pointed out that in addition to scaling because of varying resolutions, scaling can also occur by reason of image sizing, both upsizing and downsizing. In any event, the principles embodied within this method are the same.

As shown in FIG. 2, source image data is received from block 18, after which in block 44 the total number and the length of the input image lines is determined. Then in block 46 the total number and length of output lines is determined. The scaling factors X_(s) and Y_(s) for by the X and Y axis can then be determined in block 48. In block 50, the output image line to start with, and the number of lines to be processed with reference to a fixed reference point for the output image is determined. Then, the first byte of source color data information is converted to a monochrome gray scale value as determined from gray scale conversion table 28 as shown in FIG. 1, and as shown in FIG. 2 as box 52. This gray scale value is then entered, in the first element of the gray scale value array, as representationally shown in FIG. 3 as element 200 and as box 54 in FIG. 2. Next, scaled output position bits, which, in this example, for the first source pixel, would be eight output position bits, are entered, one at a time, in the first bit mask array element 201 of FIG. 3 in their proper locations within the sixteen bits of bit mask element 201, and as shown in box 56 of FIG. 2. As shown in FIG. 2, after each output position bit is entered in any bit mask element, it is tested at decision box 58 to determine whether the end of the raster row of the output image has been reached. In addition, as each output position bit is entered into a bit mask element it is counted in decision box 60 to determine when the first bit mask array contains enough output position bits to exactly fill one dither pattern tile width of the output image, which in this example is sixteen bits wide.

Since decision box 60, at this point in time, only counts eight output position bits in the first bit mask element, the color data byte for the next source pixel is retrieved and converted to its gray scale value as shown in box 62. It is then tested at decision box 64 to determine whether or not it is equal to the gray scale value of the first source pixel in box 54. If the test results indicate that the gray scale value is of a different value from that determined in box 52 and stored in box 54 for the first source pixel, then the second gray scale value is then entered into second element 202 of the gray scale value array as shown in FIG. 3 and as shown in box 68 of FIG. 2, and the appropriate number of scaled output position bits are entered into the corresponding second element 203 of the bit mask array, as shown in FIG. 3, and box 70 of FIG. 2.

The number of output position bits representing eventual output pixels are continuously counted in decision box 60 as they are entered into any element of bit mask array until the appropriate number have been entered, which equals the width of the dither pattern tiles for the monochrome output image. If the scaling ratio were lower, for example four output position bits per source pixel, conversion of source pixels would continue until a full dither pattern tile width of output position bits had been generated, with each new gray scale value encountered being entered into a new gray scale value array element and scaled output position bits being entered into the corresponding element of the bit mask array. Also, as the color data for each source pixel is converted to a gray scale value, that value is tested in decision box 64 to determine whether that gray scale value has been encountered before in the current conversion cycle. If it has, then the gray scale value is not re-entered into the next element of the gray scale value array, but instead the associated output position bits for the converted source pixel are entered into the proper relative locations within the bit mask element already associated with the previously encountered gray scale value as shown in box 66.

At this point in time, the process of conversion of source color data into gray scale value stops. It stops even if the scaling process were to call for additional output position bits for the particular source pixel being converted. In the event scaling results in unused output position bits for the last source pixel converted, and no reading ahead occurs, this source pixel is reused, for the remaining scaled output position bits, as the first new source pixel converted when the conversion process begins anew in the conversion cycle.

If scaling were not to occur, that is to say that the ratio of input to output pixels were to be one to one, and each source pixel were of a different color, and converted to a different gray scale, then sixteen elements would be needed in both gray scale value array 24 and bit mask array 26. For this reason, each array contains a sufficient number of elements to match the output dither pattern tile width. However, it is unlikely that all elements would be used in any given conversion and fill of the arrays.

Similarly, each bit mask element has a bit block large enough to hold a full dither pattern tile width, since it is much more likely that only one or two gray scale values will be encountered in any given conversion cycle.

Once the bit mask elements of the array contain the correct number of output position bits, as shown in FIG. 3, the first bit mask element 201 is tested to see if all of its sixteen bits are on, as shown in decision box 72 of FIG. 2. If they were all on, which in this first example of the conversion cycle they are not, it would indicate that the first two source pixels examined in this example were of the same color. Since not all bits in element 201 of FIG. 3 are on, the conversion process proceeds to dithering of the output position bits for eventual transmission to an output memory buffer as shown in box 96.

This dithering process begins with the selection of the correct dithering matrix for the first element 200 from the gray scale value array, as shown in box 74 as shown in FIG. 2C. Once the correct dither pattern matrix has been selected, the Y_(n) position within the output image dither pattern tile for the particular output position bits to be dithered is determined as shown in box 76 so that the same Y_(DN) position line within the dither pattern matrix can be selected. In a like manner, as shown in box 78, the X_(N) position, or the bit offset within the destination bit map dithering tile for the first output position bit to be dithered is calculated and the selected Y_(DN) row of the dithering pattern matrix is rotated, in box 80, to match the X_(DN) position of the first output position bit from dithering matrix to the X_(N) position of the first output bit in the destination dithering tile.

Thereafter, as shown in box 82, the bit mask element that corresponds to the particular gray scale value element, which in this example is bit mask element 201, is ANDed to the rotated dither pattern matrix row to generate what eventually will become output pixels. Bit mask element 201 is then ORed into a test flag to determine whether all sixteen output position bits are on as shown in decision box 84. If not, the process is repeated for the next gray scale array element 202 for the next gray scale value and associated output position bits. It would continue sequentially with the next elements of the gray scale value array and bit mask array until all sixteen bits in the test flag are on, thus generating sixteen bits of output data which, of compression is to be attempted as shown in FIG. 2E, is then divided by eight in box 86 so as to calculate the number of output bytes that will eventually be sent to the output buffer in box 96. No provision is made to save any leftover output bits or pixels, but there will be none for this group of output pixels since all of them originated only from the bit mask elements of the converted source color data which, as stated earlier in this disclosure, was divisible by eight.

If no data compression is to be performed as shown in FIG. 2D, then the output pixels will be sent directly to the output buffer where it is stored and where it will be used in the construction of a complete raster row as shown in box 96. Once the complete raster row has been constructed, it is sent to the printer engine through output port 98.

If data compression is contemplated then the next step is an attempt to compress the output data as shown in FIG. 2E. This is accomplished, as shown in box 88 by grouping the sixteen output pixels into output bytes, and comparing the bytes to each other to determine if they are of the same value as shown in decision box 90. In this particular instance the output bytes will be of differing values since they were derived from different dithering pattern matrices. As a result, in box 94, a literal run compressed data string is constructed which is sent to the output buffer where it will be used in the construction of a complete raster row command as shown in box 96. Once the complete command has been constructed it is sent to the printer through output port 98. Since there are no remaining output pixels, no remainder from box 122 is sent to the first bit mask element 201, box 56 in FIG. 2, and all the elements of both the gray scale value array 24 and the bit mask array 26 are reset to zero.

In practice, the use of the above-described conversion process using both gray scale value array 24, and the bit mask array 26 to scale output position bits without any repeating data, will typically result in a thirty percent time savings over the prior art.

In the case of repeating source data, even more significant time savings are achieved by use of the present invention. In these situations, the requirement to convert all the source color data for repeating pixels is eliminated, as is the requirement for dithering the output pixels associated with each repeating source pixel.

In the first conversion cycle the color data for two source pixels was converted which resulted in two elements of the bit mask array being used to construct a complete sixteen bit output position map. In the next conversion cycle of this example the next source pixel, the third one, begins a string of repeating pixels of the same color which extends across the raster line of the source image. The conversion of source data into gray scale data cycle begins anew as shown in FIG. 4, with the next source pixel (namely the third pixel) becoming the next first source pixel, which in box 52 of FIG. 2 is converted to a gray scale value, and in box 54 is entered into element 200 of gray scale value array 24 as shown in FIG. 4. After entry of the gray scale value into element 200, scaled output position bits are entered into bit mask element 201. The process is repeated with the next pixel, in this example source pixel number four, being converted to gray scale value in box 62 and tested in decision box 64 against the gray scale value entered in element 200, of FIG. 4 and box 54 of FIG. 2A. If the same value, which it will be if it has the same color data, then the appropriate number of scaled output position bits for source pixel four are also entered into bit mask element 201, thus filling bit mask element 201 in FIG. 4.

The count in decision box 60, having determined that a full dither pattern width of output position bits are present, initiates a test, as shown in decision box 72, to determine whether all of the bits in the first bit mask element are on. If so, all of the eventual output bits will of the same gray scale.

At this point in the process, instead of proceeding to dither the scaled output position bits, as was described in the first conversion cycle of this example, a check procedure is initiated to determine if the remaining unconverted source color data can be used to confirm whether or not additional pixels in the source row are the same color, and hence would be converted to the same gray scale value if the conversion process were to continue. By using the original source color data the need for conversion of each source pixel to a gray scale value is eliminated, thus saving considerable computing time. Additionally scaling operations and dithering, as will be explained later in this disclosure, are consolidated resulting in additional time savings.

The check procedure starts in decision box 100 with a determination of whether a single byte of source color data contains color information for more than one source pixel. If it does not, a `No` decision in box 100, or if the source color information for each source pixel is contained in more than one byte, also a `No` decision in box 100, then the byte values of the unconverted source color data for the next source pixels in the source row can be compared to the unconverted source color data for the last converted source pixel to determine if they are the same. If they are the same value, then the source pixels are the same color. The color data is compared byte for byte if the color data format is a single byte, or in the case of three byte or other multiple byte color data formats, then all multiple bytes are compared.

If the decision in box 100 is `Yes` then each source byte of color data contains color information for more than one source pixel. If this occurs, a second test is made in decision box 102 to determine whether all pixels within the byte are the same color. This is done by comparing the color data values for each source pixel within the byte. If they are the same value, then the source pixels are the same color. If the decision is `Yes`, they are of the same color, then the process can proceed can proceed with a source byte comparison the same as in the case where this data is contained in one source byte.

If the decision in box 102 is `No`, the source pixels are of different color and conversion to gray scale value and dithering proceeds as previously set forth in box 74.

Once it has been determined that the dither pattern width of output position bits generated from conversion of source pixels are all the same gray scale value, and that unconverted color data can be compared, rather than directly proceeding with the dithering process, the source address and the source color value of the last source pixel converted are saved in save boxes 106 and 104 as shown in FIG. 2B. Once saved, the process reads ahead in the source pixel row, testing each new source pixel color data value in decision box 108 to determine if it is the same as the saved source color value in save box 104. If it is the same, the address of the source pixel tested in decision box 108 is saved in save box 110, which is continuously updated with the address of the last source pixel which tested `same` in decision box 108. This process continues until the end of the source image row is reached as determined in decision box 112 or until a source pixel tests `different` in decision box 108.

Once the test in decision box 108 indicates `different` source color values or end of line is reached in decision box 112, then a test is made in decision box 114 to determine whether the address of the last converted source pixel saved in save box 106 is the same as the address of the source pixel for which the color data was last tested and saved in save box 110. If they are the same then there was no reading ahead in the source image row. If they are different then the process has read ahead in the source image row without conversion and dithering of each source pixel that is the same color as the source pixels originally converted in this cycle of operation.

Next, in box 116, the process calculates the number of source pixels from the beginning of the source image row to the address of the last saved source pixel in box 110 so as to determine the total number of scaled output pixels that need to be generated in the scaling process from the beginning of the output image row to the same relative position in the destination image as shown in box 118. From this total, in box 120, the total number of output pixels generated from skipping ahead can be computed by subtracting the number of output pixels already sent to the output buffer.

It is desirable to compute the number of output pixels generated from the source pixels that were skipped by reading ahead in this manner because the scaling process may involve scaling of source pixels to output pixels in non integer ratios and as a result an extra output pixel will be added periodically whenever the accumulation of fractional output pixels total to a complete output pixel. Also, computing the number of output pixels in this manner eliminates any potential scaling problems in the initial conversion and scaling process at the beginning of the cycle where only a dither pattern width of output position bits are accumulated in the bit mask array before being tested in decision box 72 to determine if all of the output position bits are located in the bit mask element and hence are of the same color. If they are not all in the same bit mask element, then the dither pattern width of output position bits will be dithered seriatim and any carry over of additional scaled output bits from the last read source pixel will be re-entered in the next conversion cycle as the first source pixel gray scale value and output position bits. If the test result in decision box 72 is `yes`, these same leftover output position bits are accounted for in the calculation of the total number of output bits needed to reach the same relative position in the output image as computed in box 118.

After the total number of output bits of the same color has been determined, the gray scale value from gray scale value array element 200 is selected in box 74 and it, and the Y_(N) position in the output image dither pattern tile, are used to select the correct row Y_(DN) of the correct dither pattern matrix as shown in box 76 in the same manner as in the dithering process for output pixels generated from first bit mask array element 201 in a cycle wherein there was no reading ahead. In a like manner the selected dither pattern row is rotated in box 80 so that the first dither matrix bit X_(DN) in the Y_(DN) row corresponds to the same X_(N) position for the first output, position bit in bit mask element 201 as it will be printed in the dither tile of the output image. Bit mask element 201 is then ANDed in box 82 to the rotated row of the dither pattern matrix to generate actual output pixels and ORed to insure that a complete dither pattern tile width has been generated.

If no compression is to be performed, as shown in FIG. 2D, a raster row is constructed in the output buffer as shown in box 96 for eventual transmission to the printer engine.

If data compression is to be performed, then, as shown in FIG. 2E, at this point, the calculation of the number of output bytes is performed in box 86 by dividing the number of output bits from box 120, plus the dither pattern width from bit mask array element 201, by eight. Because of the reading ahead and scaling which has occurred, the number of eventual output bytes may be substantial and there will likely be a remainder of output bits insufficient to create a final full byte. This remainder is saved in save box 122, along with the gray scale value in box 54 for inclusion in the next cycle of conversion unless the end of the row has been reached, in which case a final partial output byte will be constructed.

At this point in time the first complete dither pattern width of output bits has been divided into two repeating bytes of output data. It is also known, at this point, how many repeating bytes are required in the output string of data generated in this cycle. The dither pattern matrices that are used with the present invention are empirically determined, and wherever possible, each row of the matrix has a symmetrical pattern such that even if the row is rotated, when it is divided into output bytes, the bytes may likely be of equal value, such that the output can be constructed into repeating pairs of output bytes, for a compressed data string entry as shown in box 92.

Regardless of whether the compressed data string is constructed in box 92 or 94, it is sent to output buffer as shown in box 96 where a complete compressed data command for a destination image raster row is constructed for eventual transmission through output port 98 to the printer or other device.

Concurrent with transmission of the repeating run compressed data entry in box 92, in box 124 a command is sent to zero out the gray scale and bit mask arrays. The only exception is if there is a remainder in box 122, then the gray scale value for the remainder bits in save box 122 will be the same as that found in box 54, element 200, and therefore this element is not reset to zero. Instead, the remainder bits are reentered as the first output position bit entries in bit mask element 201 as shown in box 56.

Regardless of whether or not the conversion process included compressing data, once a complete raster row of output image pixels has been assembled in the output buffer for transmission to the printer or other device, all of scaled pixels in the X direction will have been accounted for, but the scaling in the Y direction remains to be accomplished. For this reason, the same row of source image pixels will be reused in the process a sufficient number of times to accomplish scaling in the Y direction, which in this example is eight rows, with a periodic inclusion of a ninth row when the accumulating scaling fractions total one additional row. The process is identical, but will not necessarily result in identical output raster rows since the Y_(N) position in the output image tiles will change, resulting in the selection of different rows Y_(DN) within the dithering matrices, which may or may not contain different dither patterns.

If processor 10 were to be incorporated into a printer as opposed to a host processor, or for that matter any other device where the data generated in the scaling conversion process in used directly rather than transmitted, then there is no need for data compression as previously described in FIG. 2 in the configuration shown in FIGS. 2A-E. In this case the scaling process is shown in global format in the configuration of FIG. 2 which utilized FIGS. 2A, 2B, 2C and 2D. In this configuration the first scaled Y_(N) row is constructed, stored in the output buffer and sent to the printer engine as shown in box 96 of FIG. 2D in exactly the same manner as it is in the prior configuration where data compression was used. However, thereafter the process is modified slightly to take advantage of repeating Y_(DN) rows within dither pattern matrices. These repeating Y_(DN) rows in the dither pattern matrixes will be available in a variety of situations, including, but not limited to, where Y_(s) in the scaling factor, as shown in box 48 of FIG. 2A, exceeds the number of Y_(DN) rows in the dither pattern matrix. This can occur in either situations where the dither pattern matrix has a limited number of rows Y_(DN) which repeat in the dither pattern tile, for example in situations where DN ranges from 1-4, even if utilized in a 16 row dither pattern matrix; or in situations where the scaling factor Y_(s) exceeds the number of rows Y_(DN) in the dither pattern, for example where Y_(s) =32 rows, and the dither pattern contains 16 rows, in which case two dither pattern tiles will be printed in the output image for each source image pixel. Therefore to take advantage of this repeating row feature, once the raster row Y_(N) has been constructed in the output buffer memory as shown in box 96, a decision is made in decision box 128 as to whether or not there are more Y rows to construct in the scaling process from this source row, that is whether Y_(N) is less than or equal to Y_(s). If the answer is yes in decision box 128, then in decision box 130 a decision is made as to whether or not the next row to be generated in the scaling process, Y_(N+1) is greater than the last or final row in the non-repeating dither pattern matrix Y_(DNL). If it is, then the next row would a repeat of a row already constructed in the output buffer, and in box 132 row Y_(N+1-NDL) is selected from the output buffer and is sent to the printer engine through box 98.

If the row Y_(N) constructed in box 96 was the last row in the scaling operation, as determined in decision box 128, then in box 124 the elements of both the gray scale and bit mask arrays are zeroed out and the process restarts with the entry of scaled output position bits into the first element of the bit mask array as shown in box 56. If the next row Y_(N+1) is a row not greater than or equal to the dither pattern repeating value Y_(DNL), as decided in decision box 130, then the scaling operation continues with the selection of the next Y_(DN) position in the correct dither pattern matrix as shown in box 76 of FIG. 2C. In this manner, if there are repeating rows of data utilizing repeating rows of the dither pattern matrix, then these rows stored in the output buffer, may be resent, rather than being reconstructed.

While this example involved scaling up from lower resolution to higher resolution, exactly the same process can be used for scaling down from higher resolution to lower resolution. For example, scaling down from a 600 DPI rasterized source image to a video monochrome image. In such cases the scaling is reversed, and only selected source image pixels are examined and included in the process. For example, if scaling were to occur from the 600 DPI rasterized source color image to a 300 DPI monochrome image, only every other source pixel would be converted in the conversion cycle, and/or read in the repeated data reading ahead cycle. In a like manner, this process can be used in situations where image clipping occurs, merely by modifying the identification of the beginning of each source line and the end of line tests. Similarly, it can be used for up or down sizing scaling. And finally, this process can be used to read and scale a monochrome source image.

While there is shown and described the present preferred embodiment of the invention, it is to be distinctly understood that this invention is not limited thereto but may be variously embodied to practice within the scope of the following claims. ##SPC1## 

What is claimed:
 1. In a processor unit that converts source pixel image data to rows of a monochrome rasterized bit map, said processor unit including random access memory, a processor, and a control memory containing a gray scale value conversion table, a plurality of dithering matrices, procedures for determining the location of an output pixel within an output image dither tile for the monochrome rasterized bit map, scaling conversion procedures for generating factored, scaled, output position bits in both an X and a Y direction, a method for converting source image data to output data for a monochrome rasterized bit map which comprises:a. establishing in the random access memory an array of elements for storing gray scale values; b. establishing in the random access memory an array of bit mask elements, each having a bit block for storing output position bits, each of said elements being indexed to a corresponding gray scale value element, and each being sized to hold a plurality of output position bits equal to the number of bits in a row of an output image dither pattern tile; c. converting the data information of a source pixel into a corresponding gray scale value; d. generating scaled output position bits for the converted source pixel; e. storing each different gray scale value obtained from conversion of said data information in a separate element of the gray scale value array; f. storing said output position bits in the bit mask array element indexed to the gray scale array element for the source pixel from which output position bits were generated, said output position bits being stored within the bit mask element in the same relative location, relative to the other output position bits, as the relative position of the source pixel relative to the other converted source pixels; g. repeating steps (c) through (f), until a sufficient number of source pixels have been converted to generate a plurality of output position bits equal to the number of bits in a row of an output image dither pattern tile; h. testing to determine whether all of the output position bits are stored in one bit mask element; i. if the test indicates all of the output position bits are stored in one bit mask element, then comparing unconverted source pixel data information for the next source pixel, to the unconverted data information for the last converted source pixel until either the end of the source row is encountered or until data information of unequal value is encountered; j. saving the address of the last source pixel having data information of the same value as the data information of the last converted source pixel; k. calculating the number of output position bits that would be generated from the tested, and counted, source pixels having the same value of data information; i. dithering the stored output position bits stored in the bit mask element to generate bits of output data; and m. if the test result indicates that output position bits are stored in more than one bit mask element, then dithering the stored output position bits in each element of the bit mask array holding stored output position bits to generate bits of output data.
 2. The method as recited in claim 1 which further comprises:n. compressing the bits output data for the calculated number of output position bits in step (k) into a compressed data output signal; and o. assembling an output signal from the unassembled bits of output data from step (m) to form an output signal;
 3. The method as recited in claim 2 wherein step (n) further comprises:(n)(1) calculating the number of output bytes by dividing the number of output position bits calculated in step (k) by eight; (n)(2) grouping the output position bits into bytes of eight bits each; (n)(3) saving any remainder output position bits; (n)(4) grouping the bits of output data from step (l) into bytes of output signal; (n)(5) comparing the output signal bytes generated in step (n)(4) to determine if they are the same or if they are different; (n)(6) if the comparison conducted in step (n)(5) indicates that the output signal bytes are different, then constructing a literal run of output signal bytes using the bytes of output signal generated in step (n)(4) and the number of output bytes determined in step (n)(1); (n)(7) if the comparison conducted in step (n)(5) indicated that the output signal bytes are the same, then constructing a repeating run compressed data output signal; (n)(8) rewriting the first element of the bit mask array to include a number of output position bits equal to the remainder of output position bits determined in step (n)(3).
 4. The method as recited in claim 1 which further comprises of repeating step (c) through (m) for the source pixels converted in steps (c) through (g) to generate a number of additional rows of monochromed rasterized bit maps equal to the Y scaling factor.
 5. The method as recited in claim 4 wherein step (m) further comprises:m(1) ORing the unassembled bits of output data generated in step (n) into a test array to generated an assemblage of output data bits; m(2) dividing the assemblage of output data bits into groups of eight to form bytes of output signal.
 6. The method as recited in claim 1 which further comprises the additional step (q), counting the number of output data bits for each monochrome rasterized bit map row stored in the output buffer.
 7. The method as recited in claim 6 wherein step (k) further comprises:k(1) calculating the number of source pixels from the beginning of the source row to the last compared source pixel having data information of equal value to the last converted source pixel; k(2) calculating the number of scaled output position bits to be generated from the beginning of the monochrome bit map row for the number of source pixels calculated in step k(1); k(3) subtracting from the number calculated in step k(2) the number of output data bits in the row stored having been previously generated.
 8. The method as recited in claims 7 wherein step (m) further comprises:m(1) ORing the unassembled bits of output data generated in step (n) into a test array to generated an assemblage of output data bits; m(2) dividing the assemblage of output data bits into groups of eight to form bytes of output signal.
 9. The method as recited in claim 6 wherein step (l) further comprises:l(1) calculating the Y position within the dither pattern tile for the output position bit in the first position within the filled bit mask element; l(2) calculating the X position within the dither pattern tile for the output position bit in the first position within the filled bit mask element; l(3) using the gray scale value stored in the element corresponding to the element of the bit mask array filled with output position bits, to select a dither pattern matrix; l(4) rotating the selected dither pattern matrix to reposition to the first position within said dither pattern matrix, the dither pattern matrix bit having a location corresponding to the X and Y positions calculated in steps I(1) and 1(2); l(5) ANDing the output position bits of the bit mask element to the rotated dither pattern matrix to generate bits of output data.
 10. The method as recited in claim 6 wherein step (m) further comprises:m(1) ORing the unassembled bits of output data generated in step (n) into a test array to generated an assemblage of output data bits; m(2) dividing the assemblage of output data bits into groups of eight to form bytes of output signal.
 11. The method as recited in claim 1 wherein step (k) further comprises:k(1) calculating the number of source pixels from the beginning of the source row to the last compared source pixel having data information of equal value to the last converted source pixel; k(2) calculating the number of scaled output position bits to be generated from the beginning of the monochrome bit map row for the number of source pixels calculated in step k(1); k(3) subtracting from the number calculated in step k(2) the number of output data bits in the row stored having been previously generated.
 12. The method as recited in claim 11 wherein step (l) further comprises:l(1) calculating the Y position within the dither pattern tile for the output position bit in the first position within the filled bit mask element; l(2) calculating the X position within the dither pattern tile for the output position bit in the first position within the filled bit mask element; l(3) using the gray scale value stored in the element corresponding to the element of the bit mask array filled with output position bits, to select a dither pattern matrix; l(4) rotating the selected dither pattern matrix to reposition to the first position within said dither pattern matrix, the dither pattern matrix bit having a location corresponding to the X and Y positions calculated in steps l(1) and l(2); l(5) ANDing the output position bits of the bit mask element to the rotated dither pattern matrix to generate bits of output data.
 13. The method as recited in claims 5 wherein step (m) further comprises:m(1) ORing the unassembled bits of output data generated in step (n) into a test array to generated an assemblage of output data bits; m(2) dividing the assemblage of output data bits into groups of eight to form bytes of output signal.
 14. The method as recited in claim 1 wherein step (l) further comprises:l(1) calculating the Y position within the dither pattern tile for the output position bit in the first position within the filled bit mask element; l(2) calculating the X position within the dither pattern tile for the output position bit in the first position within the filled bit mask element; l(3) using the gray scale value stored in the element corresponding to the element of the bit mask array filled with output position bits, to select a dither pattern matrix; l(4) rotating the selected dither pattern matrix to reposition to the first position within said dither pattern matrix, the dither pattern matrix bit having a location corresponding to the X and Y positions calculated in steps l(1) and l(2); l(5) ANDing the output position bits of the bit mask element to the rotated dither pattern matrix to generate bits of output data.
 15. The method as recited in claims 14 wherein step (m) further comprises:m(1) ORing the unassembled bits of output data generated in step (n) into a test array to generated an assemblage of output data bits; m(2) dividing the assemblage of output data bits into groups of eight to form bytes of output signal.
 16. The method as recited in claim 1 wherein step (i) further comprises:(i)(1) testing to determine whether a byte of source image data contains information for more than one source pixel; (i)(2) if the test conducted in step (i)(1) indicates that data is present in each source image data byte for more that one source pixel, then testing the data for each source pixel contained within each byte to determine whether they are equal; (i)(3) if the test conducted in step (i)(2) indicates that the data for each source pixel contained within a byte of source image data are the same, then comparing unconverted bytes of unconverted data information for the next source pixels, to the unconverted byte of data information for the last converted source pixels until either the end of the source row is encountered or until a byte of data information of unequal value is encountered; (i)(4) if the test conducted in step (i)(2) indicates that the data for each source pixel contained within a byte of source image data are different, then skip steps (j) through (m); (i)(5) if the test conducted in step (i)(1) indicates that the data for more than one source pixel is not contained within each byte of source image data, then compare unconverted bytes of unconverted data information for the next source pixels, to the unconverted bytes of data information for the last converted source pixel until either the end of the source row is encountered or until bytes of data information of unequal value are encountered.
 17. In a processor unit that converts source pixel image data to rows of a monochrome rasterized bit map, said processor unit including random access memory, a processor, and a control memory containing a gray scale value conversion table, a plurality of dithering matrices, procedures for determining the location of an output pixel within an output image dither tile for the monochrome rasterized bit map, scaling conversion procedures for generating factored, scaled, output position bits in both an X and a Y direction, a storage device for storing rows of a monochrome rasterized bit map, and a method for converting source image data of output data bits in row X of monochrome rasterized bit map, characterized by:a. establishing in the random access memory an array of elements for storing gray scale values; b. establishing in the random access memory an array of bit mask elements, each having a bit block for storing output position bits, each of said elements being indexed to a corresponding gray scale value element, and each being sized to hold a plurality of output position bits equal to the number of bits in a row of an output image dither pattern tile; c. calculating the number of scaled output position bits in the X direction and the number of scaled Y rows of rasterized bit map to be generated for each source pixels to be converted; d. determining the number of Y rows to be generating before encountering Y rows of repeating data in a selected dither pattern matrix; e. converting the data information of a source pixel into a corresponding gray scale value; f. generating scaled output position bits for the converted source pixel; g. storing each different gray scale value obtained from conversion of said data information in a separate element of the gray scale value array; h. storing said output position bits in the bit mask array element indexed to the gray scale array element for the source pixel from which output position bits were generated, said output position bits being stored within the bit mask element in the same relative location, relative to the other output position bits, as the relative position of the source pixel relative to the other converted source pixels; i. repeating steps (e) through (h), until a sufficient number of source pixels have been converted to generate a plurality of output position bits equal to the number of bits in a row of an output image dither pattern tile; j. testing to determine whether all of the output position bits are stored in one bit mask element; if the test indicates all of the output position bits are stored in one bit mask element, then comparing unconverted source pixel data information for the next source pixel, to the unconverted data information for the last converted source pixel until either the end of the source row is encountered or until data information of unequal value is encountered; saving the address of the last source pixel having data information of the same value as the data information of the last converted source pixel; m. calculating the number of output position bits that would be generated from the tested, and counted, source pixels having the same value of data information; n. dithering the stored output position bits stored in the bit mask element to generate bits of output data; o. if the test result indicates that output position bits are stored in more than one bit mask element, then dithering the stored output position bits in each element of the bit mask array holding stored output position bits to generate bits of output data; p. storing the output data bits in the storage device; q. assembling a row of rasterized bit map in the storage device; r. repeating step (e) through (q) for the source pixels converted in steps (e) through (i) to generate the number of additional rows of monochromed rasterized bit maps before encountering Y rows of repeating data; and s. if additional scaled Y rows of repeating data rasterized bit map are to be generated from the scaling of the first source pixel, then selecting from the stored rows, and resending, the repeated Y rows of rasterized bit map. 